/******************************************************************************
* Copyright (C) 2010-2011 Computer Graphics Systems Group at the 
* Hasso-Plattner-Institute (HPI), Potsdam, Germany.
*
* Lecture : Geovisualisation Summer Term 2011
* Exercise: Processing Rendering OpenStreetMap Data 
*
* Author: sebastian.pasewaldt@hpi.uni-potsdam.de
*
******************************************************************************/

#ifndef __AREANODE_H__
#define __AREANODE_H__


//[-------------------------------------------------------]
//[ Includes                                              ]
//[-------------------------------------------------------]

#include <osg/Array>
#include <osg/Geode>
#include <QtCore/QList>

#include <QString>

#include "ToggleNode.h"

//[-------------------------------------------------------]
//[ Classes                                               ]
//[-------------------------------------------------------]

class AreaNode: public ToggleNode
{
    //[-------------------------------------------------------]
    //[ Public functions                                      ]
    //[-------------------------------------------------------]
    public:
		/**
		*  @brief
		*    Constructor
		*/
		AreaNode(osg::ref_ptr<osg::Vec3Array> outerVerticies, QList<osg::ref_ptr<osg::Vec3Array> > innerVerticies, QString featureCategory, QString name, unsigned int category);

        AreaNode(osg::ref_ptr<osg::Vec3Array> vertices, QString featureCategory, QString name, unsigned int category);
		
		~AreaNode();

        QString getFeatureString();
        osg::Vec3Array* constructPolyboard(osg::Vec3Array* points);
        osg::Vec3 calculateNormal(const osg::Vec3& v1, const osg::Vec3& v2);

    //[-------------------------------------------------------]
    //[ Private functions                                     ]
    //[-------------------------------------------------------]
    private:
		/**
		*  @brief
		*    sets the m_color based on a given category (encoded as unsigned int)
		*/
		void styleArea(unsigned int category);


    //[-------------------------------------------------------]
    //[ Private data                                          ]
    //[-------------------------------------------------------]
    private:
		QString m_name;
        QString m_category;
        float m_width;

};


#endif // __AREANODE_H__